/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package es.unavarra.mti.iws.model;

import es.unavarra.mti.iws.logic.properties.HasProperties;
import es.unavarra.mti.iws.logic.properties.KProperty;
import es.unavarra.mti.iws.utils.ReflectionUtils;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Asier
 */
public class Object2D implements HasProperties{
    private float x,y;

    public Object2D() {}

    public Object2D(float x, float y) {
        this.x = x;
        this.y = y;
    }

    

    public float getX() {
        return x;
    }

    public void setX(float x) {
        this.x = x;
    }

    public float getY() {
        return y;
    }

    public void setY(float y) {
        this.y = y;
    }

    @Override
    public List<KProperty> objectProperties() {
        List<KProperty> prop = new ArrayList<KProperty>();
        insertMyProperties(prop);
        return prop;
    }


    @Override
    public List<KProperty> objectProperties(Class<? extends HasProperties> c) {
        if (Object2D.class.isAssignableFrom( c )){
            List<KProperty> prop = new ArrayList<KProperty>();
            insertMyProperties(prop);
            return prop;
        }
        return new ArrayList<KProperty>();
    }

    private void insertMyProperties(List<KProperty> prop) {
        prop.add(ReflectionUtils.createProperty(Object2D.class, "x"));
        prop.add(ReflectionUtils.createProperty(Object2D.class, "y"));
    }
}
